package com.example.framework.config;

import com.alibaba.druid.pool.DruidDataSource;
import org.springframework.boot.autoconfigure.quartz.QuartzDataSource;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;

/**
 * @Author 王鹤蒲
 * @Date 2023 11 15
 */


@Configuration
public class DataSourceConfig {

    @Primary
    @Bean
    @ConfigurationProperties(prefix = "spring.datasource.dynamic.datasource.master")
    public DruidDataSource primaryDataSource(){
      return  new DruidDataSource();
    }

    @QuartzDataSource
    @Bean
    @ConfigurationProperties(prefix = "spring.datasource.dynamic.datasource.quartz")
    public DruidDataSource quartzDataSource(){
        return  new DruidDataSource();
    }
}
